package com.yuri.platform.core.service;

import com.yuri.platform.core.entry.BaseEntry;
import com.yuri.platform.core.mapper.BaseMapper;
import org.springframework.beans.factory.annotation.Autowired;

public class BaseService<M extends BaseMapper, E extends BaseEntry> {

    protected M mapper;

    @Autowired
    public void setMapper(M mapper) {
        this.mapper = mapper;
    }

    public int save(E entity) {
        entity.preInsert();
        return this.mapper.save(entity);
    }
}
